package info.techgeek.labs.objectReferencing;

import java.awt.Dimension;

public class ReferenceTest {

	public static void main(String[] args) {
		Dimension d = new Dimension(5, 10);
		
		ReferenceTest rt = new ReferenceTest();
//		System.out.println("Before modify() d.height = " + d.height);
//		rt.modify(d);
//		System.out.println("After modify() d.height = " + d.height);
		
		Dimension dim = new Dimension(5, 10);
		Dimension dim1 = new Dimension(20, 40);
		rt.swap(dim, dim1);
		System.out.println("dim " + dim.height+" dim1 "+dim1.height);
	}

	void modify(Dimension dim) {
		dim.height = dim.height + 1;
		System.out.println("dim = " + dim.height);
	}
	
	void swap(Dimension dim,Dimension dim1) {
		Dimension dimTemp = dim;
		dim = dim1;
		dim.setSize(6, 12);
		dim1 = dimTemp;
		System.out.println("dim " + dim.height+" dim1 "+dim1.height+" dim temp "+dimTemp.height);
	}
}
